﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BugTracker.BusinessLogic.Company
{
    public class CompanyMapper : ICompanyMapper
    {
        #region ICompanyMapper Members

        public DataAccess.Data.Company Map(BusinessEntities.Entities.Company.Company value)
        {
            DataAccess.Data.Company result = new DataAccess.Data.Company();
            result.CompanyID = value.CompanyID;
            result.Name = value.Name;
            result.Description = value.Description;
            result.CompanyTypeID = value.CompanyTypeID;
            result.Address = value.Address;
            result.Phone = value.Phone;
            result.IsActive = value.IsActive;
            result.IsDeleted = value.IsDeleted;
            result.RowGuid = value.RowGuid;
            result.CreatedOn = value.CreatedOn;
            result.ModifiedOn = value.ModifiedOn;
            return result;
        }

        public BusinessEntities.Entities.Company.Company Map(DataAccess.Data.Company value)
        {
            BusinessEntities.Entities.Company.Company result = 
                new BusinessEntities.Entities.Company.Company();
            result.CompanyID = value.CompanyID;
            result.Name = value.Name;
            result.Description = value.Description;
            result.CompanyTypeID = value.CompanyTypeID;
            result.Address = value.Address;
            result.Phone = value.Phone;
            result.IsActive = value.IsActive;
            result.IsDeleted = value.IsDeleted;
            result.RowGuid = value.RowGuid;
            result.CreatedOn = value.CreatedOn;
            result.ModifiedOn = value.ModifiedOn;
            return result;
        }

        public void Map(DataAccess.Data.Company result, BusinessEntities.Entities.Company.Company value, bool includeKey = false)
        {
            if (includeKey)
            {
                value.CompanyID = result.CompanyID;
            }
            value.Name = result.Name;
            result.Description = value.Description;
            result.CompanyTypeID = value.CompanyTypeID;
            result.Address = value.Address;
            result.Phone = value.Phone;
            value.IsActive = result.IsActive;
            value.IsDeleted = result.IsDeleted;
            value.RowGuid = result.RowGuid;
            value.CreatedOn = result.CreatedOn;
            value.ModifiedOn = result.ModifiedOn;
        }

        public void Map(BusinessEntities.Entities.Company.Company result, DataAccess.Data.Company value, bool includeKey = false)
        {
            if (includeKey)
            {
                value.CompanyID = result.CompanyID;
            }
            value.Name = result.Name;
            result.Description = value.Description;
            result.CompanyTypeID = value.CompanyTypeID;
            result.Address = value.Address;
            result.Phone = value.Phone;
            value.IsActive = result.IsActive;
            value.IsDeleted = result.IsDeleted;
            value.RowGuid = result.RowGuid;
            value.CreatedOn = result.CreatedOn;
            value.ModifiedOn = result.ModifiedOn;
        }

        #endregion
    }
}
